﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Data;
using LTSMZ.life.Model;
using Qianli.DirSir.Common;

namespace LTSMZ.life.DAL
{
    public class GoodsReceiptDal
    {
        SQLHelper helper = new SQLHelper();
        /// <summary>
        /// 收货人地址
        /// </summary>
        /// <param name="Mid"></param>
        /// <returns></returns>
        public List<GoodsReceipt> ShowGoodsReceipt(int Mid)
        {
            string str = "select * from GoodsReceipt join Member on GoodsReceipt.Mid=Member.Mid where Member.Mid=@mid";
            SqlParameter[] para = new SqlParameter[]{
                new SqlParameter("@mid",Mid)
            };
            DataTable table=helper.ExecDataTable(str,para);
            List<GoodsReceipt> list = new List<GoodsReceipt>();
            if(table.Rows.Count>0)
            {
                foreach (DataRow item in table.Rows)
	            {
	            	 GoodsReceipt receipt = new GoodsReceipt();
                    receipt.Rid=Convert.ToInt32(item["Rid"]);
                    receipt.City = item["City"].ToString();
                    receipt.Area = item["Area"].ToString();
                    receipt.Street = item["Street"].ToString();
                    receipt.RDefault = Convert.ToInt32(item["RDefault"]);
                    receipt.Mid = Convert.ToInt32(item["Mid"]);
                    receipt.Mname = item["Mname"].ToString();
                    receipt.Mpassword = item["Mpassword"].ToString();
                    receipt.NickName = item["NickName"].ToString();
                    receipt.RealName = item["RealName"].ToString();
                    receipt.Sex = item["Sex"].ToString();
                    receipt.Tel = item["Tel"].ToString();
                    list.Add(receipt);
	            }
              
            }
            return list;
        }
    }
}
